/*
 * @Author: scopesang
 * @Date: 2022-04-08 11:04:28
 * @LastEditors: scopesang
 * @LastEditTime: 2022-04-08 11:12:58
 * @FilePath: \cms-manage\src\textApp\App06ContextYe.jsx
 * @Description: 爷爷组件
 * 
 * Copyright (c) 2022 by scopesang/大鹏科技, All Rights Reserved. 
 */
import React, { Component } from 'react'
import App06ContextFather from './App06ContextFather'
import PropTypes from 'prop-types'
export default class App06ContextYe extends Component {
    // 在父组件中，声明数据类型和值
    // 定义子组件上下文类型
    static childContextTypes = {
        num: PropTypes.number
    }
    //向上下文控件中存值 获取子组件上下文
    getChildContext() {
        return {
            num: this.state.num
        }
    }

    state = {
        num: 888
    }

    render() {
        return (
            <div>
                <App06ContextFather />
            </div>
        )
    }
}
